package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.JtProtocolTermsMapper;
import com.ruoyi.business.domain.JtProtocolTerms;
import com.ruoyi.business.service.IJtProtocolTermsService;
import com.ruoyi.common.core.text.Convert;

/**
 * 条款协议Service业务层处理
 * 
 * @author Alan Zhang
 * @date 2025-05-28
 */
@Service
public class JtProtocolTermsServiceImpl implements IJtProtocolTermsService 
{
    @Autowired
    private JtProtocolTermsMapper jtProtocolTermsMapper;

    /**
     * 查询条款协议
     * 
     * @param protocolId 条款协议主键
     * @return 条款协议
     */
    @Override
    public JtProtocolTerms selectJtProtocolTermsByProtocolId(Long protocolId)
    {
        return jtProtocolTermsMapper.selectJtProtocolTermsByProtocolId(protocolId);
    }

    /**
     * 查询条款协议
     *
     * @param protocolNumber 条款协议主键
     * @return 条款协议
     */
    @Override
    public JtProtocolTerms selectJtProtocolTermsByProtocolNumber(String protocolNumber){
        return jtProtocolTermsMapper.selectJtProtocolTermsByProtocolNumber(protocolNumber);
    }

    /**
     * 查询条款协议列表
     * 
     * @param jtProtocolTerms 条款协议
     * @return 条款协议
     */
    @Override
    public List<JtProtocolTerms> selectJtProtocolTermsList(JtProtocolTerms jtProtocolTerms)
    {
        return jtProtocolTermsMapper.selectJtProtocolTermsList(jtProtocolTerms);
    }

    /**
     * 新增条款协议
     * 
     * @param jtProtocolTerms 条款协议
     * @return 结果
     */
    @Override
    public int insertJtProtocolTerms(JtProtocolTerms jtProtocolTerms)
    {
        jtProtocolTerms.setCreateTime(DateUtils.getNowDate());
        return jtProtocolTermsMapper.insertJtProtocolTerms(jtProtocolTerms);
    }

    /**
     * 修改条款协议
     * 
     * @param jtProtocolTerms 条款协议
     * @return 结果
     */
    @Override
    public int updateJtProtocolTerms(JtProtocolTerms jtProtocolTerms)
    {
        jtProtocolTerms.setUpdateTime(DateUtils.getNowDate());
        return jtProtocolTermsMapper.updateJtProtocolTerms(jtProtocolTerms);
    }

    /**
     * 批量删除条款协议
     * 
     * @param protocolIds 需要删除的条款协议主键
     * @return 结果
     */
    @Override
    public int deleteJtProtocolTermsByProtocolIds(String protocolIds)
    {
        return jtProtocolTermsMapper.deleteJtProtocolTermsByProtocolIds(Convert.toStrArray(protocolIds));
    }

    /**
     * 删除条款协议信息
     * 
     * @param protocolId 条款协议主键
     * @return 结果
     */
    @Override
    public int deleteJtProtocolTermsByProtocolId(Long protocolId)
    {
        return jtProtocolTermsMapper.deleteJtProtocolTermsByProtocolId(protocolId);
    }
}
